package com.teach;

/**
 * <pre>
 * -
 * Author : J.L.Zhou
 * E-Mail : 2233875735@qq.com
 * Tel : 151 1104 7708
 * Date : 2021-04-27 15:45
 * Version : 1.0
 * Copyright 2021 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 **/
public class ThreadDemo03 implements  Runnable {
  @Override
  public void run() {
    for(int i=0;i<100;i++){
      System.out.println(Thread.currentThread().getName()+":"+i);
    }
  }

  public static void main(String[] args) {
    ThreadDemo03 demo03 = new ThreadDemo03();
    //demo03.run();//方法调用
    //demo03.start();//不存在，Runnable不是线程对象
    new Thread(demo03,"线程一").start();
    new Thread(demo03,"线程二").start();
    new Thread(new Runnable() {
      @Override
      public void run() {
        for(int i=0;i<100;i++){
          System.out.println(Thread.currentThread().getName()+":"+i);
        }
      }
    },"线程三").start();

    new Thread(()->{
      for(int i=0;i<100;i++){
        System.out.println(Thread.currentThread().getName()+":"+i);
      }
    },"线程四").start();



  }
}
